#include "Task.h"

#include <QRegularExpression>
#include <QDebug>
#include <QMap>
Task::Task(QObject *parent) : QObject(parent)
{

}

void Task::taskSort(QString str)
{qDebug()<<"str:"<<str<<endl;
    QRegularExpression reg1("(?<=\\;).*?(?=\\:)");
    QRegularExpressionMatchIterator iterKey = reg1.globalMatch(str);
    QRegularExpression reg2("(?<=\\:).*?(?=\\;)");
    QRegularExpressionMatchIterator iterValue = reg2.globalMatch(str);
    QMap<QString,QString> kv;
    while (iterKey.hasNext() && iterValue.hasNext())
        kv.insert(iterKey.next().captured(0),iterValue.next().captured(0));
    qDebug()<<"kv------------:"<<kv<<endl;
    emit this->receiveServerData_signal(kv.value("function").toInt(),kv);
}
